package guava.study.lyh.other;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 作者 yaohua.liu
 * 时间 2014-07-09 11:30
 * 包名 com.qunar.fresh.lyh
 * 说明 ...
 */
public class Singleton {

    private  static final Singleton singleton=new Singleton();
    static {
        System.out.println(singleton==null);
    }

    private Singleton(){}

    public static Singleton getInstance(){
        return singleton;
    }

    public static void main(String[] args) {
        ExecutorService pool= Executors.newCachedThreadPool();

        for(;;){
            pool.execute(new Runnable() {
                @Override public void run() {
                    System.out.println(Singleton.getInstance().hashCode());
                }
            });
        }
    }
}
